<%--
  Created by IntelliJ IDEA.
  User: mac
  Date: 2022/9/17
  Time: 23:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<base href="http://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/"/>
<script type="text/javascript" src="js/jquery-1.8.1.js"></script>
<body>
<a href="test.html">显示</a>
<button id="btn">json</button>
</body>
<script>
    $("#btn").click(function () {
        var student = {
            "stuId": 999,
            "stuName": "tom",
            "stuAge": 23,
            "schoolList": [
                {
                    "schoolName": "schoolONe", "schoolSize": 500
                }, {
                    "schoolName": "schoolTwo", "schoolSize": 1000
                }, {
                    "schoolName": "schoolThree", "schoolSize": 2000
                }],
            "scoreMap": {
                "yingyu": 100,
                "shuxue": 80,
                "wuli": 90
            }
        };

        var requestBdoy = JSON.stringify(student)
        $.ajax({
            "url": "test/stu.json",
            "type": "post",
            "data": requestBdoy,
            "contentType": "application/json;charset=UTF-8",
            "dataType": "text",
            "success": function (response) {
                console.log(response);
            },
            "error": function (response) {
                console.log(response);
            }
        })
    })
</script>
</html>
